package modbus

type ReadCoilsParams struct {
	Address  uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	Quantity uint16 `mapstructure:"quantity" md:"quantity" json:"quantity,omitempty"`
}

// ReadDiscreteInputs reads from 1 to 2000 contiguous status of
// discrete inputs in a remote device and returns input status.
type ReadDiscreteInputs struct {
	Address  uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	Quantity uint16 `mapstructure:"quantity" md:"quantity" json:"quantity,omitempty"`
}

// WriteSingleCoil write a single output to either ON or OFF in a
// remote device and returns output value.
type WriteSingleCoil struct {
	Address uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	Value   uint16 `mapstructure:"value" md:"value" json:"value,omitempty"`
}

// WriteMultipleCoils forces each coil in a sequence of coils to either
// ON or OFF in a remote device and returns quantity of outputs.
type WriteMultipleCoils struct {
	Address  uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	Quantity uint16 `mapstructure:"quantity" md:"quantity" json:"quantity,omitempty"`
	Value    []byte `mapstructure:"value" md:"value" json:"value,omitempty"`
}

// 16-bit access

// ReadInputRegisters reads from 1 to 125 contiguous input registers in
// a remote device and returns input registers.
type ReadInputRegisters struct {
	Address  uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	Quantity uint16 `mapstructure:"quantity" md:"quantity" json:"quantity,omitempty"`
}

// ReadHoldingRegisters reads the contents of a contiguous block of
// holding registers in a remote device and returns register value.
type ReadHoldingRegisters struct {
	Address  uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	Quantity uint16 `mapstructure:"quantity" md:"quantity" json:"quantity,omitempty"`
}

// WriteSingleRegister writes a single holding register in a remote
// device and returns register value.
type WriteSingleRegister struct {
	Address uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	Value   uint16 `mapstructure:"value" md:"value" json:"value,omitempty"`
}

// WriteMultipleRegisters writes a block of contiguous registers
//  struct {1 to 123 registers} in a remote device and returns quantity of
// registers.
type WriteMultipleRegisters struct {
	Address  uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	Quantity uint16 `mapstructure:"quantity" md:"quantity" json:"quantity,omitempty"`
	Value    []byte `mapstructure:"value" md:"value" json:"value,omitempty"`
}

// ReadWriteMultipleRegisters performs a combination of one read
// operation and one write operation. It returns read registers value.
type ReadWriteMultipleRegisters struct {
	ReadAddress   uint16 `mapstructure:"readAddress" md:"readAddress" json:"readAddress,omitempty"`
	ReadQuantity  uint16 `mapstructure:"readQuantity" md:"readQuantity" json:"readQuantity,omitempty"`
	WriteAddress  uint16 `mapstructure:"writeAddress" md:"writeAddress" json:"writeAddress,omitempty"`
	WriteQuantity uint16 `mapstructure:"writeQuantity" md:"writeQuantity" json:"writeQuantity,omitempty"`
	Value         []byte `mapstructure:"value" md:"value" json:"value,omitempty"`
}

// MaskWriteRegister modify the contents of a specified holding
// register using a combination of an AND mask, an OR mask, and the
// register's current contents. The function returns
// AND-mask and OR-mask.
type MaskWriteRegister struct {
	Address uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
	AndMask uint16 `mapstructure:"andMask" md:"andMask" json:"andMask,omitempty"`
	OrMask  uint16 `mapstructure:"orMask" md:"orMask" json:"orMask,omitempty"`
}

//ReadFIFOQueue reads the contents of a First-In-First-Out  struct {FIFO} queue
// of register in a remote device and returns FIFO value register.
type ReadFIFOQueue struct {
	Address uint16 `mapstructure:"address" md:"address" json:"address,omitempty"`
}
